<template>
    <div class="shis">
        <ul class="cityNames">
            <li  v-for="(item,index) of options" :key="index" @click="toThisCity(item.City)">
                <span>{{item.City}}</span>
                <!-- <span class="iconfont"> &#xe74e;</span> -->
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    name: "CommonSelecty",
    computed:{
        options(){
            return this.$store.state.cities
        }
    },
    methods:{
        toThisCity(name){
            //this.$comjs.onCenter(120.155161,30.236581,800000.0)//定位到该城市。
            this.$store.commit('changeCityName', name);
            if(this.$store.state.forq==0){
                localStorage.setItem('headerCity', name);
                //this.$router.push('/city/' + name)
                window.location.href= "http://" + window.location.host + '/city/' + name;
            }else if(this.$store.state.forq==1){
                localStorage.setItem('headerCity', name);
                this.$store.commit("changeCityName",name); 
                //this.$router.push('/cityW/' + name);
                window.location.href= "http://" + window.location.host + '/cityW/' + name;
            } 
        },
    }
}
</script>

<style lang="stylus" scoped>
    .shis
        min-height:18.9vh
        position:absolute
        left:185px
        top:55px
        z-index:100
        cursor : pointer
        display : flex
        ul
            width:135px
            background: rgba(31,39,49,0.9)
            border:1px solid #7d7d7d   
            padding-top:5px
            padding-bottom:5px 
            li
                font-size: 14px
                color: white
                height: 25px
                line-height: 25px
                text-indent: 5px
                span 
                    display: inline-block
                    height: 25px
                    line-height: 25px
                span.iconfont
                    float: right
                    padding-right: 5px
            li:hover
                background:#2FDEFD
                color: black
        .cityNames
            background: rgba(31,39,49,0.9)
            min-height:18.9vh
        .countyNames
            background: rgba(31,39,49,0.9)
            min-height:18.9vh
        .stationNames
            background: rgba(31,39,49,0.9)
            min-height:18.9vh
</style>

